﻿using Newtonsoft.Json;
using System;

namespace InkjetControl.codec
{
    public class Body<T> : IBody
    {

        public Body()
        {
            Cmd = NetCmd.UNKNOWN_CMD;
        }
        public Body(NetCmd cmd, ref T data)
        {
            Cmd = cmd;
            Data = data;

        }

        public Body(NetCmd cmd)
        {
            Cmd = cmd;
        }

        [JsonProperty("cmd")]
        public NetCmd Cmd { get; set; }

        [JsonProperty("data")]
        public T Data { get; set; }

        public override string ToString()
        {
            return string.Format("[ cmd:{0}, data:{1} ]", Cmd, Data);
        }

       
    }

}